//
//  FKChooseAddressCell.m
//  HappyTest
//
//  Created by Macbook Pro on 2019/2/19.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKChooseAddressCell.h"

@interface FKChooseAddressCell ()

@property (nonatomic, weak) UIButton *checkBtn;
@property (nonatomic, weak) UILabel *nameLabel;
@property (nonatomic, weak) UILabel *mobileLabel;
@property (nonatomic, weak) UILabel *addressLabel;

@end

@implementation FKChooseAddressCell

- (void)setupSubviews
{
    [super setupSubviews];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UIButton *checkBtn = [UIButton fk_btnWithTarget:nil action:nil font:nil normalTitle:nil normalTitleColor:nil selectedTitle:nil selectedTitleColor:nil normalImg:[UIImage imageNamed:@"address_choose_uncheck"] selectedImg:[UIImage imageNamed:@"address_choose_selected"] bgImg:nil selectedBgImg:nil];
    [self.contentView addSubview:checkBtn];
    self.checkBtn = checkBtn;
    checkBtn.userInteractionEnabled = false;
    
    UILabel *addressLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:addressLabel];
    self.addressLabel = addressLabel;
    addressLabel.numberOfLines = 3;
    
    UILabel *nameLabel = [UILabel fk_labelWithFont:fk_adjustFont(15) textColor:fkColor333333];
    [self.contentView addSubview:nameLabel];
    self.nameLabel = nameLabel;
    
    UILabel *mobileLabel = [UILabel fk_labelWithFont:fk_adjustFont(15) textColor:fkColor333333 textAlignment:NSTextAlignmentRight];
    [self.contentView addSubview:mobileLabel];
    self.mobileLabel = mobileLabel;
    
    [checkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.offset(0);
        make.width.mas_equalTo(fk_adjustW(58));
    }];
    [addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(checkBtn.mas_right);
        make.right.offset(-12);
        make.top.offset(fk_adjustW(20));
    }];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(addressLabel);
        make.bottom.offset(fk_adjustW(-20));
    }];
    [mobileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(addressLabel);
        make.centerY.equalTo(nameLabel);
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    self.checkBtn.selected = [data[@"selected"] boolValue];
    self.addressLabel.text = fkFORMAT(@"%@%@%@%@", data[@"province"], data[@"city"], data[@"county"], data[@"detail_info"]);
    self.nameLabel.text = data[@"shperson"];
    self.mobileLabel.text = data[@"mobile"];
    
    
//    self.nameLabel.text = data[@"shperson"];
//    self.mobileLabel.text = data[@"mobile"];
//    self.addressLabel.text = fkFORMAT(@"%@%@%@%@", data[@"province"], data[@"city"], data[@"county"], data[@"detail_info"]);
//    self.setDefaultBtn.selected = [data[@"status"] isEqualToString:@"1"];
}

@end
